package com.zbkj.front.service.impl.mszs;

import com.zbkj.common.request.mszs.MszsCenterRequest;
import com.zbkj.common.response.mszs.MszsCenterResponse;
import com.zbkj.front.service.mszs.MszsCenterService;
import com.zbkj.service.service.mszs.MszsOrderService;
import com.zbkj.service.service.mszs.MszsRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 民宿助手-个人中心
 */

@Service
public class MszsCenterServiceImpl implements MszsCenterService {

    @Autowired
    private MszsOrderService orderService;

    @Autowired
    private MszsRoomService roomService;
    @Override
    public MszsCenterResponse statistics(MszsCenterRequest request) {

        MszsCenterResponse response = new MszsCenterResponse();
        Map<String,Object> map = new HashMap<>();

        Integer orders = orderService.ordes(request); //订单数量
        map.put("orders",orders);

        Integer checkIns = orderService.checkIns(request); //入住数量
        map.put("checkIns",checkIns);

        Integer rooms = roomService.rooms(request); //订房数量
        map.put("rooms",rooms);


        response.setStatistics(map);
        return response;
    }
}
